package com.sebastian.studies.ch10_MyPoint3D;

public class MyPoint3D extends MyPoint {
	
	private int x;
	private int y;
	private int z;

	public MyPoint3D() {
		super();
		this.x = 0;
		this.y = 0;
		this.z = 0;
	}

	public MyPoint3D(int x, int y, int z) {
		super();
		this.x = x;
		this.y = y;
		this.z = z;
	}

	public int getZ() {
		return z;
	}

	public double distance(MyPoint3D point1, MyPoint3D point2) {
		double distanceToSqr = 
				  ((point1.getX() - point2.getX()) * (point1.getX() - point2.getX()))
				+ ((point1.getY() - point2.getY()) * (point1.getY() - point2.getY())) 
				+ ((point1.getZ() - point2.getZ()) * (point1.getZ() - point2.getZ()));
		double distance = Math.sqrt(distanceToSqr);
		return distance;
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}
}
